package com.dragon.repository.mapper;

import com.dragon.repository.entity.RepairProduct;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 维修产品表 Mapper 接口
 * </p>
 *
 * @author sy
 * @since 2023-12-05
 */
@Mapper
public interface RepairProductMapper extends BaseMapper<RepairProduct> {



    @Select("SELECT a.*,b.`name` as name ,b.specification ,c.`name` as unitName, b.material as material, b.remark as remark  FROM dragon_repair_product a " +
            "LEFT JOIN dragon_vendor_products b ON  a.product_id = b.id " +
            "LEFT JOIN dragon_dictsort_detail c ON c.code_type = 'unitCode' AND b.unit = c.id " +
            " WHERE a.repair_id = #{repairId}")
    List<RepairProduct> selectListByMainId(Integer repairId);

}
